In an async function, after awaiting, the cancelled state for the
class-tracked cancellable may not respect the actual state of the
cancellable that has been used to perform the call.
Thus, let's use a local variable instead
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4080>
return;
this._cancellable.cancel();
- this._cancellable = new Gio.Cancellable();
+ const cancellable = new Gio.Cancellable();
+ this._cancellable = cancellable;
- const metas = await this.provider.getResultMetas(metasNeeded, this._cancellable);
+ const metas = await this.provider.getResultMetas(metasNeeded, cancellable);
- if (this._cancellable.is_cancelled()) {
+ if (cancellable.is_cancelled()) {
if (metas.length > 0)
throw new Error(`Search provider ${this.provider.id} returned results after the request was canceled`);
}